﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="备品备件登记.aspx.cs" Inherits="syc.Jidong.备品备件登记" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
    <form id="form1" runat="server">
         <div id="wintop" class="wintop">备品备件登记</div>   
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
	            <tr>
		            <td class="grid-title">备品备件登记
		                <asp:ScriptManager ID="ScriptManager1" runat="server">
                        </asp:ScriptManager>
                    </td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"                                           
                            SelectCommand="SELECT [备品备件库存].ID,[备品备件].品名,[备品备件].规格,[备品备件库存].数量
                                           FROM [备品备件] INNER JOIN
                                                [备品备件库存] ON [备品备件].ID = [备品备件库存].品名ID 
                                           WHERE ([生产线] = @生产线)" 
                            DeleteCommand="DELETE FROM [备品备件库存] WHERE [ID] = @ID" 
                            InsertCommand="INSERT INTO [备品备件库存] ([品名ID], [数量]) VALUES (@品名ID, @数量)" 
                            UpdateCommand="UPDATE [备品备件库存] SET [数量] = @数量 WHERE [ID] = @ID">
                                    <SelectParameters>
                                        <asp:QueryStringParameter DefaultValue="1" Name="生产线" 
                                    QueryStringField="fenchang" Type="Int16" />
                                    </SelectParameters>
                                    <DeleteParameters>
                                        <asp:Parameter Name="ID" Type="Int32" />
                                    </DeleteParameters>
                                    <UpdateParameters>
                                        <asp:Parameter Name="品名ID" Type="Int32" />
                                        <asp:Parameter Name="数量" Type="Single" />
                                        <asp:Parameter Name="ID" Type="Int32" />
                                    </UpdateParameters>
                                    <InsertParameters>
                                        <asp:Parameter Name="品名ID" Type="Int32" />
                                        <asp:Parameter Name="数量" Type="Single" />
                                    </InsertParameters>
                                </asp:SqlDataSource>
                                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                                    AllowSorting="True" AutoGenerateColumns="False" CssClass="grid" 
                                    DataKeyNames="ID" DataSourceID="SqlDataSource2" GridLines="None" 
                                    ondatabound="GridView1_DataBound" 
                                    onpageindexchanged="GridView1_PageIndexChanged" UseAccessibleHeader="False">
                                    <PagerSettings Visible="False" />
                                    <RowStyle CssClass="grid-row-normal" />
                                    <Columns>
                                        <asp:CommandField ShowEditButton="True" ButtonType="Button" >
                                        <ItemStyle CssClass="smallbutton" />
                                        </asp:CommandField>
                                        <asp:BoundField DataField="品名" HeaderStyle-CssClass="grid-header" 
                                            HeaderText="品名" ItemStyle-CssClass="grid" ItemStyle-Width="160" 
                                            SortExpression="品名">
                                        <HeaderStyle CssClass="grid-header" />
                                        <ItemStyle CssClass="grid" Width="160px" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="规格" HeaderStyle-CssClass="grid-header" 
                                            HeaderText="规格" ItemStyle-CssClass="grid" ItemStyle-Width="160" 
                                            SortExpression="规格">
                                        <HeaderStyle CssClass="grid-header" />
                                        <ItemStyle CssClass="grid" Width="160px" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="数量" HeaderStyle-CssClass="grid-header" 
                                            HeaderText="数量" ItemStyle-CssClass="grid" ItemStyle-HorizontalAlign="Center" 
                                            ItemStyle-Width="80" SortExpression="数量">
                                        <HeaderStyle CssClass="grid-header" />
                                        <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                                        </asp:BoundField>
                                    </Columns>
                                </asp:GridView>
                                <table width="100%">
                                    <tr>
                                        <td class="pagebar">
                                            <asp:Button ID="Button_Pager_First" runat="server" CommandName="--" 
                                                CssClass="pageturn-first-b" onclick="Pager_Click" Text="" ToolTip="首页" />
                                            <asp:Button ID="Button_Pager_Prev" runat="server" CommandName="-" 
                                                CssClass="pageturn-prev-b" onclick="Pager_Click" Text="" ToolTip="上一页" />
                                            <input class="page-split" type="button" />第<asp:TextBox ID="TextBox_Pager" 
                                                runat="server" CssClass="pageturn" ontextchanged="Pager_Click"></asp:TextBox>
                                            页<input class="page-split" type="button" /><asp:Label ID="Label_Pages" 
                                                runat="server"></asp:Label>
                                            <input class="page-split" type="button" />
                                            <asp:Button ID="Button_Pager_Next" runat="server" CommandName="+" 
                                                CssClass="pageturn-next-b" onclick="Pager_Click" Text="" ToolTip="下一页" />
                                            <asp:Button ID="Button_Pager_Last" runat="server" CommandName="++" 
                                                CssClass="pageturn-last-b" onclick="Pager_Click" Text="" ToolTip="末页" />
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>
		            </td>
	            </tr>
            </table>
            

        </div>
    </div>

   </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }
</script>    
</body>
</html>
